{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>男女生性别占比</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        #echart01 {
            width: 600px;
            height: 400px;
            border: 1px solid #000;
            border-radius: 10px;
            margin: 50px auto;
        }
    </style>
    <script src="{% static 'js/jquery-3.4.1.min.js' %}"></script>
    <script src="https://lib.baomitu.com/echarts/4.7.0/echarts.min.js"></script>
</head>
<body>
<div id="echart01"></div>
</body>
</html>
<script>
    //实例化一个echarts对象
    var mycharts01 = echarts.init(document.getElementById('echart01'));
    //
    var array01 = [
         {value: {{ result.1 }}, name: '男生'},
         {value: {{ result.0 }}, name: '女生'}
    ];
    //设置饼状图
    var option = {
        title:{
            text: '2016级计算机应用班级性别比列',
            x:'center',
            y:'bottom',
        },
        tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b}: {c} ({d}%)'
        },
        legend: {
            orient: 'vertical',
            left: 10,
            data: ['男生', '女生']
        },
        series: [
            {
                name: '访问来源',
                type: 'pie',
                radius: ['50%', '70%'],
                avoidLabelOverlap: false,
                label: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    label: {
                        show: true,
                        fontSize: '30',
                        fontWeight: 'bold'
                    }
                },
                labelLine: {
                    show: false
                },
                data: array01,
            }
        ]
    };
    //为实例化的echarts对象设置属性
    mycharts01.setOption(option)
</script>